package lex.lianliankan;

import javax.swing.JFrame;

import org.lex.app.Application;

import lex.lianliankan.ui.MainContentPane;
import lex.lianliankan.ui.MainMenuBar;

public class Lianliankan extends Application
{
	public static final void main( String args[] )
	{
		Application.launch( Lianliankan.class, args );
	}

	public static Lianliankan getApplication()
	{
		return Application.getApplication( Lianliankan.class );
	}

	private JFrame mainframe = null;
	private MainContentPane contentPane = null;

	@Override
	public String getApplicationID()
	{
		return "lianliankan";
	}

	@Override
	public JFrame getRootWindow()
	{
		if( null == mainframe )
		{
			mainframe = new JFrame();
			mainframe.setTitle( "������" );
			mainframe.setName( Lianliankan.class.getName() + ".mainframe" );
			mainframe.setContentPane( this.getContentPane() );
			mainframe.setJMenuBar( new MainMenuBar() );
		}
		return mainframe;
	}

	public MainContentPane getContentPane()
	{
		if( null == contentPane )
			contentPane = new MainContentPane();
		return contentPane;
	}

	@Override
	protected void initialize( String[] args )
	{
		this.getContext().getSessionStorage().restore( this.getRootWindow() );
		this.getRootWindow().setVisible( true );
	}

	@Override
	protected void shutdown()
	{
		this.getContext().getSessionStorage().save( this.getRootWindow() );
	}
}
